//
//  CarConditionBPanView.m
//  carcareIOS
//
//  Created by 王然 on 16/8/15.
//  Copyright © 2016年 chezheng. All rights reserved.
//

#import "CarConditionBPanView.h"
#define CENTER_VIEW_WIDTH (77 * __MAIN_RATIO_375)
@interface CarConditionBPanView()

@property (nonatomic , strong) UIView * headV;

@property (nonatomic , strong) UIView * bottomV;

@end
@implementation CarConditionBPanView
- (instancetype)init
{
    self = [super initWithFrame:CGRectMake(0, 0, __MAIN_WIDTH, BOTTOM_PAN_HEIGHT + BOTTOM_PAN_ADD_HEIGHT)];
    if (self) {
        CGFloat VW = 35 ;
        CGFloat VY = 8 ;
        CGFloat VH = 4 ;
        self.headV = [[[[UIView viewWithFrame:CGRectMake((__MAIN_WIDTH - VW ) / 2, VY, VW, VH)] setupOnView:self] resetCornerRadius:2] resetBackgroundColor:COLOR_RGBA(234, 234, 234, 1)];
        self.bottomV = [[[[UIView viewWithFrame:CGRectMake(self.headV.origin.x, self.headV.bottom + VY / 2, self.headV.width, self.headV.height)] resetCornerRadius:2] setupOnView:self] resetBackgroundColor:self.headV.backgroundColor];
    }
    return self;
}
- (void)drawRect:(CGRect)rect
{
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetLineWidth(context, 1);
    CGContextSetStrokeColorWithColor(context, COLOR_HEXSTRING(@"#CECECE").CGColor);
    CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);
    
    CGFloat leftLineW = (__MAIN_WIDTH - CENTER_VIEW_WIDTH) / 2;
    CGFloat leftLineY = BOTTOM_PAN_HEIGHT;
    CGFloat cornerR = 5;
    CGContextMoveToPoint(context, 0, leftLineY);
    CGContextAddLineToPoint(context, leftLineW, leftLineY);
    CGContextAddLineToPoint(context, leftLineW, cornerR * 2);
    
    
    CGContextAddArcToPoint(context, leftLineW, 0, leftLineW + cornerR * 2, 0, cornerR);
    CGContextAddArcToPoint(context, leftLineW + CENTER_VIEW_WIDTH, 0, leftLineW + CENTER_VIEW_WIDTH, cornerR * 2, cornerR);
    
    CGContextAddLineToPoint(context, leftLineW + CENTER_VIEW_WIDTH, leftLineY);
    CGContextAddLineToPoint(context, __MAIN_WIDTH, leftLineY);
    CGContextDrawPath(context, kCGPathEOFillStroke);
//    CGContextClosePath(context);
    
    
}

@end
